package com.wxj.book.service.impl;

import com.wxj.book.dao.UserMapper;
import com.wxj.book.pojo.User;
import com.wxj.book.service.UserService;
import com.wxj.book.utils.MD5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    /**
     * 用户登录
     * @param user
     * @return
     */
    @Override
    public User login(User user) {
        String password = MD5Util.MD5EncodeUtf8(user.getPassword());
        Integer stuNum = user.getStuNum();
        User loginUser = userMapper.login(stuNum, password);
        return loginUser;
    }
}
